##// END OF EJS Templates
auth: disable password change form for accounts that are not managed by RhodeCode....
marcink -
r1275:b650c2de default
parent child Browse files
Show More
@@ -81,6 +81,9 b' class MyAccountController(BaseController'
81 " crucial for entire application"), category='warning')
81 " crucial for entire application"), category='warning')
82 return redirect(url('users'))
82 return redirect(url('users'))
83
83
84 c.auth_user = AuthUser(
85 user_id=c.rhodecode_user.user_id, ip_addr=self.ip_addr)
86
84 def _load_my_repos_data(self, watched=False):
87 def _load_my_repos_data(self, watched=False):
85 if watched:
88 if watched:
86 admin = False
89 admin = False
@@ -109,8 +112,7 b' class MyAccountController(BaseController'
109 # url('my_account')
112 # url('my_account')
110 c.active = 'profile_edit'
113 c.active = 'profile_edit'
111 self.__load_data()
114 self.__load_data()
112 c.perm_user = AuthUser(user_id=c.rhodecode_user.user_id,
115 c.perm_user = c.auth_user
113 ip_addr=self.ip_addr)
114 c.extern_type = c.user.extern_type
116 c.extern_type = c.user.extern_type
115 c.extern_name = c.user.extern_name
117 c.extern_name = c.user.extern_name
116
118
@@ -182,8 +184,7 b' class MyAccountController(BaseController'
182 """
184 """
183 c.active = 'profile_edit'
185 c.active = 'profile_edit'
184 self.__load_data()
186 self.__load_data()
185 c.perm_user = AuthUser(user_id=c.rhodecode_user.user_id,
187 c.perm_user = c.auth_user
186 ip_addr=self.ip_addr)
187 c.extern_type = c.user.extern_type
188 c.extern_type = c.user.extern_type
188 c.extern_name = c.user.extern_name
189 c.extern_name = c.user.extern_name
189
190
@@ -199,6 +200,7 b' class MyAccountController(BaseController'
199 def my_account_password(self):
200 def my_account_password(self):
200 c.active = 'password'
201 c.active = 'password'
201 self.__load_data()
202 self.__load_data()
203 c.extern_type = c.user.extern_type
202
204
203 schema = user_schema.ChangePasswordSchema().bind(
205 schema = user_schema.ChangePasswordSchema().bind(
204 username=c.rhodecode_user.username)
206 username=c.rhodecode_user.username)
@@ -206,7 +208,7 b' class MyAccountController(BaseController'
206 form = forms.Form(schema,
208 form = forms.Form(schema,
207 buttons=(forms.buttons.save, forms.buttons.reset))
209 buttons=(forms.buttons.save, forms.buttons.reset))
208
210
209 if request.method == 'POST':
211 if request.method == 'POST' and c.extern_type == 'rhodecode':
210 controls = request.POST.items()
212 controls = request.POST.items()
211 try:
213 try:
212 valid_data = form.validate(controls)
214 valid_data = form.validate(controls)
@@ -254,8 +256,7 b' class MyAccountController(BaseController'
254 def my_account_perms(self):
256 def my_account_perms(self):
255 c.active = 'perms'
257 c.active = 'perms'
256 self.__load_data()
258 self.__load_data()
257 c.perm_user = AuthUser(user_id=c.rhodecode_user.user_id,
259 c.perm_user = c.auth_user
258 ip_addr=self.ip_addr)
259
260
260 return render('admin/my_account/my_account.html')
261 return render('admin/my_account/my_account.html')
261
262
@@ -1,5 +1,13 b''
1 <%namespace name="widgets" file="/widgets.html"/>
1 <%namespace name="widgets" file="/widgets.html"/>
2
2
3 <%widgets:panel title="${_('Change Your Account Password')}">
3 <%widgets:panel title="${_('Change Your Account Password')}">
4
5 % if c.extern_type != 'rhodecode':
6 <p>${_('Your user account details are managed by an external source. Details cannot be managed here.')}
7 <br/>${_('Source type')}: <strong>${c.extern_type}</strong>
8 </p>
9 % else:
4 ${c.form.render() | n}
10 ${c.form.render() | n}
11 % endif
12
5 </%widgets:panel>
13 </%widgets:panel>
@@ -15,7 +15,10 b''
15 <% disabled = "disabled" %>
15 <% disabled = "disabled" %>
16 <div class="infoform">
16 <div class="infoform">
17 <div class="fields">
17 <div class="fields">
18 <p>${_('Your user account details are managed by an external source, i.e. LDAP. Details cannot be managed here.')}.</p>
18 <p>${_('Your user account details are managed by an external source. Details cannot be managed here.')}
19 <br/>${_('Source type')}: <strong>${c.extern_type}</strong>
20 </p>
21
19 <div class="field">
22 <div class="field">
20 <div class="label">
23 <div class="label">
21 <label for="username">${_('Username')}:</label>
24 <label for="username">${_('Username')}:</label>
General Comments 0
You need to be logged in to leave comments. Login now