diff options
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-x | GradeBook_lib.tcl | 24 |
1 files changed, 23 insertions, 1 deletions
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" } } |