summaryrefslogtreecommitdiff
path: root/GradeBook_lib.tcl
diff options
context:
space:
mode:
authorEugeniy Mikhailov <evgmik@gmail.com>2011-01-26 00:51:33 -0500
committerEugeniy Mikhailov <evgmik@gmail.com>2011-01-26 00:51:33 -0500
commit5ac82bbf41a2b6ffb394d1b4ed8db9a02b9ad5bd (patch)
tree539a0820ed7f5e79d6b16adf6a197e9085aefb7f /GradeBook_lib.tcl
parent5f524625f4fb3e6e1fdb370b0b6e0ca31c73822f (diff)
downloadGradeBook-5ac82bbf41a2b6ffb394d1b4ed8db9a02b9ad5bd.tar.gz
GradeBook-5ac82bbf41a2b6ffb394d1b4ed8db9a02b9ad5bd.zip
added reset password action
Ignore-this: 1519912052aa3ae64c7127d45652a04 darcs-hash:20110126055133-067c0-b4431aab38d114336ef2b67d08378d9fe59e134d.gz
Diffstat (limited to 'GradeBook_lib.tcl')
-rwxr-xr-xGradeBook_lib.tcl24
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" }
}