Subversion Repositories wimsdev

Rev

Rev 15473 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2368 bpr 1
!read adm/class/classlang names.phtml
23 reyssat 2
 
3
wims_prefix=class user tmp n sharing sharable
4
!read adm/class/authchars
5
max_addition=100
6
wims_form_method=post
7
wims_helper=chapter=3
8
 
4828 guerimand 9
!read tabletheme
10
 
23 reyssat 11
!if $wims_user!=supervisor
14332 bpr 12
  !bound job within user,none default none
23 reyssat 13
!else
14332 bpr 14
  !bound job within class,user,part,none default none
23 reyssat 15
!endif
16
 
17
!defread wimshome/log/classes/$wims_class/.def
18
!if $class_expiration=$empty
14332 bpr 19
  error=bad_class
20
  !exit
23 reyssat 21
!endif
22
 
23
part=!trim $part
24
!if $part=$empty and $job=part
14332 bpr 25
  job=none
23 reyssat 26
!endif
27
 
28
pw1=!items2words $pw1
29
pw2=!items2words $pw2
30
pw1=!trim $pw1
31
pw2=!trim $pw2
32
pw1=!singlespace $pw1
33
pw2=!singlespace $pw2
34
 
35
!if $job=none or ($old=$empty and $job notwordof class part) or\
14332 bpr 36
    ($pw1=$empty or $pw2=$empty)
37
  !exit
23 reyssat 38
!endif
39
 
40
!if $pw1!=$pw2
14332 bpr 41
  error=discord
42
  !exit
23 reyssat 43
!endif
44
 
45
pw=!char 1 of $pw1
46
!if $pw=+ and $job=user
14332 bpr 47
  pw1=!char 2 to -1 of $pw1
48
  pw1=!trim $pw1
49
  once=true
23 reyssat 50
!endif
51
t=!wordcnt $pw1
52
!if $t>1 and $job!=user
14332 bpr 53
  error=bad_pass
54
  !exit
23 reyssat 55
!endif
56
 
57
n=!charcnt $pw1
58
!if $n>$max_addition
14332 bpr 59
  error=too_long
60
  !exit
23 reyssat 61
!endif
62
!for i=1 to $t
14332 bpr 63
  pw=!word $i of $pw1
64
  n=!charcnt $pw
65
  !if $n>$passwd_max
66
    error=too_long
67
    !exit
68
  !endif
69
  !if $n>0 and $n<$passwd_min
70
    error=too_short
71
    !exit
72
  !endif
73
  !if $once!=true and $pw=$old
74
    error=nothing_to_do
75
    !exit
76
  !endif
77
  test=!text select $char_passwd in $pw
78
  !if $test!=$pw
79
    error=bad_pass
80
    !exit
81
  !endif
23 reyssat 82
!next i
83
 
84
!if $job=part
14332 bpr 85
  !read adm/class/userdef classes,$wims_class,$part
86
  !defread $userdef
87
  !if $user_exists!=yes
88
    error=bad_user
89
    !exit
90
  !endif
91
  pw1=!passcrypt $pw1
92
  !setdef !set user_password=$pw1 in $userdef
93
  pass=!getdef user_password in $userdef
94
  !if $pass=$pw1
15324 bpr 95
    !!should be always the case
14332 bpr 96
    error=success
97
    wims_module_log=Change participant password: $part by $wims_realuser in $wims_class
98
    wims_class_log=change password: $part by $wims_realuser
16615 guerimand 99
    !setdef !set user_forcechpwd=yes in $userdef
14332 bpr 100
  !else
101
    error=fail
102
  !endif
23 reyssat 103
  !exit
104
!endif
105
 
106
!if $job=user
14332 bpr 107
  !read adm/class/userdef classes,$wims_class,$wims_user
108
  !if $wims_user=supervisor
109
    !read var.auth
110
    !if $error!=$empty
111
      !exit
112
    !endif
23 reyssat 113
  !endif
14332 bpr 114
  !defread $userdef
115
  anc=!word 1 of $user_password
116
  anc=!passcrypt $anc
117
  old=!passcrypt $old
118
  !if $old!=$anc
119
    error=bad_user_password
120
    !exit
121
  !endif
122
  !if $once=true
123
    pw1=$anc $pw1
124
  !endif
125
  pw1=!passcrypt $pw1
126
  !setdef !set user_password=$pw1 in $userdef
127
  pass=!getdef user_password in $userdef
128
  !if $pass=$pw1
129
    error=success
130
    wims_module_log=Change user password: $wims_user $wims_realuser in $wims_class
16615 guerimand 131
    !setdef !set user_forcechpwd=no in $userdef
14332 bpr 132
    !if $wims_user=supervisor
133
      wims_class_log=change password by $wims_realuser
134
      !read lang/mail.proc.$moduclass_lang
135
    !endif
136
  !else
137
    error=fail
138
  !endif
23 reyssat 139
  !exit
140
!endif
141
 
142
!if $job=class
14332 bpr 143
  !if $wims_user!=supervisor
144
    error=not_supervisor
145
    !exit
146
  !endif
147
  !read var.auth
148
  !if $error!=$empty
149
    !exit
150
  !endif
15473 bpr 151
  !!no verification with the old class_password
152
  class_pass=!passcrypt $pw1
153
  !setdef !set class_password=$class_pass in wimshome/log/classes/$wims_class/.def
154
  passclass_check=!passcheck $pw1 and $class_pass
155
  !! so the test is always true ??
156
  !! from the origin, perhaps to be able to check more in the future ??
157
   !if $passclass_check=yes
14332 bpr 158
    error=success
159
    wims_module_log=Change class password $wims_class by $wims_realuser in $wims_class.
160
    wims_class_log=change class password by $wims_realuser
161
  !else
162
    error=fail
163
  !endif
23 reyssat 164
!endif