diff options
author | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-26 00:51:33 -0500 |
---|---|---|
committer | Eugeniy Mikhailov <evgmik@gmail.com> | 2011-01-26 00:51:33 -0500 |
commit | 5ac82bbf41a2b6ffb394d1b4ed8db9a02b9ad5bd (patch) | |
tree | 539a0820ed7f5e79d6b16adf6a197e9085aefb7f | |
parent | 5f524625f4fb3e6e1fdb370b0b6e0ca31c73822f (diff) | |
download | GradeBook-5ac82bbf41a2b6ffb394d1b4ed8db9a02b9ad5bd.tar.gz GradeBook-5ac82bbf41a2b6ffb394d1b4ed8db9a02b9ad5bd.zip |
added reset password action
Ignore-this: 1519912052aa3ae64c7127d45652a04
darcs-hash:20110126055133-067c0-b4431aab38d114336ef2b67d08378d9fe59e134d.gz
-rwxr-xr-x | GradeBook.tcl | 2 | ||||
-rwxr-xr-x | GradeBook_lib.tcl | 24 |
2 files changed, 24 insertions, 2 deletions
diff --git a/GradeBook.tcl b/GradeBook.tcl index c33c2df..0389cb0 100755 --- a/GradeBook.tcl +++ b/GradeBook.tcl @@ -43,7 +43,7 @@ set timestamp [clock format [clock seconds] -format "%Y-%m-%dT%H:%M:%S"] #CreateAccessRightsTable db dbg [::ncgi::names] 4 # logon and logoff actions are granted to everyone -if { $action == "logon" } { LogMeOn; set action defaultview } +if { $action == "logon" } { set action [ LogMeOn ] } if { $action == "logoff" } { LogMeOff; set action defaultview } diff --git a/GradeBook_lib.tcl b/GradeBook_lib.tcl index ddd3e49..fce6e53 100755 --- a/GradeBook_lib.tcl +++ b/GradeBook_lib.tcl @@ -139,6 +139,7 @@ proc CreateAccessRightsTable {db} { AddAccessRightNonWeb addnewuserinfo 1 0 0 0 AddAccessRightNonWeb choosenewpassword 1 1 1 0 AddAccessRightNonWeb setnewpassword 1 1 1 0 + AddAccessRightNonWeb resetforgottenpassword 0 0 0 1 } proc htmlErrorMsg { msg } { @@ -354,14 +355,28 @@ proc askToLogin {} { puts "Either you are here first time or you password and user name does not match. <br>" puts "Please login <br>" puts "<form name=\"input\" action=\"$script_name\" method=\"post\" />" - puts "Login: <input type=\"text\" name=\"user\" value=\"$user\"><br>" + puts "Login (email): <input type=\"text\" name=\"user\" value=\"$user\"><br>" puts {Password: <input type="password" name="password"><br>} puts {<input type="hidden" name="action" value="logon"/>} puts {<input type="submit" value="Submit" />} + puts {<br>} + puts {If you don not know your password, fill in login box and push <input type="submit" name="subaction" value="Reset password" />} puts {</form>} puts "</div>" } +proc ResetForgottenPassword { permission_list user } { + global script_name + + if { [SelectColValue4User UserName $user] eq "" } { + htmlErrorMsg "Cannot reset password for unknown user {$user}" + return + } + + #reset password procedure goes here + htmlErrorMsg "Reset password is not fully implemented yet" +} + proc LogMeOn {} { global user password set user [::ncgi::value user guest] @@ -369,6 +384,12 @@ proc LogMeOn {} { dbg "Logging in and setting cookies" 4 ::ncgi::setCookie -name user -value $user ::ncgi::setCookie -name password -value $password + + set subaction [::ncgi::value subaction {}] + if { $subaction eq "Reset password" } { + return resetforgottenpassword + } + return defaultview } proc LogMeOff {} { @@ -451,6 +472,7 @@ proc ChoseAction {action permission_list user} { choosenewpassword { ChooseNewPassword db $permission_list $user } setnewpassword { SetNewPassword db $permission_list $user htmlDefaultView $permission_list $user } + resetforgottenpassword { ResetForgottenPassword $permission_list $user } defaultview { htmlDefaultView $permission_list $user } default { htmlErrorMsg "requested action <b>$action</b> is granted but not implemented yet" } } |