Switch to unified view

a/Allura/allura/lib/plugin.py b/Allura/allura/lib/plugin.py
...
...
142
                'target': "/auth/prefs",
142
                'target': "/auth/prefs",
143
                'alt': 'Manage Subscription Preferences',
143
                'alt': 'Manage Subscription Preferences',
144
            },
144
            },
145
        ]
145
        ]
146
146
147
    def project_url(self, user):
147
    def user_project_shortname(self, user):
148
        '''
148
        '''
149
        :param user: a :class:`User <allura.model.auth.User>`
149
        :param user: a :class:`User <allura.model.auth.User>`
150
        :rtype: str
150
        :rtype: str
151
        '''
151
        '''
152
        raise NotImplementedError, 'project_url'
152
        raise NotImplementedError, 'user_project_shortname'
153
153
154
    def user_by_project_url(self, shortname):
154
    def user_by_project_shortname(self, shortname):
155
        '''
155
        '''
156
        :param str: shortname
156
        :param str: shortname
157
        :rtype: user: a :class:`User <allura.model.auth.User>`
157
        :rtype: user: a :class:`User <allura.model.auth.User>`
158
        '''
158
        '''
159
        raise NotImplementedError, 'user_by_project_url'
159
        raise NotImplementedError, 'user_by_project_shortname'
160
160
161
    def update_notifications(self, user):
161
    def update_notifications(self, user):
162
        raise NotImplemented, 'update_notifications'
162
        raise NotImplemented, 'update_notifications'
163
163
164
class LocalAuthenticationProvider(AuthenticationProvider):
164
class LocalAuthenticationProvider(AuthenticationProvider):
...
...
205
            salt = ''.join(chr(randint(1, 0x7f))
205
            salt = ''.join(chr(randint(1, 0x7f))
206
                           for i in xrange(M.User.SALT_LEN))
206
                           for i in xrange(M.User.SALT_LEN))
207
        hashpass = sha256(salt + password.encode('utf-8')).digest()
207
        hashpass = sha256(salt + password.encode('utf-8')).digest()
208
        return 'sha256' + salt + b64encode(hashpass)
208
        return 'sha256' + salt + b64encode(hashpass)
209
209
210
    def project_url(self, user):
210
    def user_project_shortname(self, user):
211
        return '/u/' + user.username.replace('_', '-') + '/'
211
        return 'u/' + user.username.replace('_', '-')
212
212
213
    def user_by_project_url(self, shortname):
213
    def user_by_project_shortname(self, shortname):
214
        from allura import model as M
214
        from allura import model as M
215
        return M.User.query.get(username=shortname)
215
        return M.User.query.get(username=shortname)
216
216
217
    def update_notifications(self, user):
217
    def update_notifications(self, user):
218
        return ''
218
        return ''
...
...
623
        :return: None, or an easywidgets Form to render on the user preferences page
623
        :return: None, or an easywidgets Form to render on the user preferences page
624
        '''
624
        '''
625
        from allura.lib.widgets.forms import PasswordChangeForm
625
        from allura.lib.widgets.forms import PasswordChangeForm
626
        return PasswordChangeForm(action='/auth/prefs/change_password')
626
        return PasswordChangeForm(action='/auth/prefs/change_password')
627
627
628
    @LazyProperty 
628
    @LazyProperty
629
    def personal_data_form(self): 
629
    def personal_data_form(self):
630
        ''' 
630
        '''
631
        :return: None, or an easywidgets Form to render on the user preferences page 
631
        :return: None, or an easywidgets Form to render on the user preferences page
632
        ''' 
632
        '''
633
        from allura.lib.widgets.forms import PersonalDataForm 
633
        from allura.lib.widgets.forms import PersonalDataForm
634
        return PersonalDataForm()
634
        return PersonalDataForm()
635
635
636
    @LazyProperty 
636
    @LazyProperty
637
    def add_telnumber_form(self): 
637
    def add_telnumber_form(self):
638
        ''' 
638
        '''
639
        :return: None, or an easywidgets Form to render on the user preferences page to 
639
        :return: None, or an easywidgets Form to render on the user preferences page to
640
                 allow adding a telephone number.
640
                 allow adding a telephone number.
641
        ''' 
641
        '''
642
        from allura.lib.widgets.forms import AddTelNumberForm 
642
        from allura.lib.widgets.forms import AddTelNumberForm
643
        return AddTelNumberForm()
643
        return AddTelNumberForm()
644
644
645
    @LazyProperty 
645
    @LazyProperty
646
    def add_website_form(self): 
646
    def add_website_form(self):
647
        ''' 
647
        '''
648
        :return: None, or an easywidgets Form to render on the user preferences page to 
648
        :return: None, or an easywidgets Form to render on the user preferences page to
649
                 allow adding a personal website url.
649
                 allow adding a personal website url.
650
        ''' 
650
        '''
651
        from allura.lib.widgets.forms import AddWebsiteForm 
651
        from allura.lib.widgets.forms import AddWebsiteForm
652
        return AddWebsiteForm()
652
        return AddWebsiteForm()
653
653
654
    @LazyProperty 
654
    @LazyProperty
655
    def skype_account_form(self): 
655
    def skype_account_form(self):
656
        ''' 
656
        '''
657
        :return: None, or an easywidgets Form to render on the user preferences page to 
657
        :return: None, or an easywidgets Form to render on the user preferences page to
658
                 allow setting the user's Skype account.
658
                 allow setting the user's Skype account.
659
        ''' 
659
        '''
660
        from allura.lib.widgets.forms import SkypeAccountForm 
660
        from allura.lib.widgets.forms import SkypeAccountForm
661
        return SkypeAccountForm()
661
        return SkypeAccountForm()
662
662
663
    @LazyProperty 
663
    @LazyProperty
664
    def remove_textvalue_form(self): 
664
    def remove_textvalue_form(self):
665
        ''' 
665
        '''
666
        :return: None, or an easywidgets Form to render on the user preferences page to 
666
        :return: None, or an easywidgets Form to render on the user preferences page to
667
                 allow removing a single text value from a list.
667
                 allow removing a single text value from a list.
668
        ''' 
668
        '''
669
        from allura.lib.widgets.forms import RemoveTextValueForm 
669
        from allura.lib.widgets.forms import RemoveTextValueForm
670
        return RemoveTextValueForm()
670
        return RemoveTextValueForm()
671
671
672
    @LazyProperty 
672
    @LazyProperty
673
    def add_socialnetwork_form(self):
673
    def add_socialnetwork_form(self):
674
        '''
674
        '''
675
        :return: None, or an easywidgets Form to render on  the user preferences page to 
675
        :return: None, or an easywidgets Form to render on  the user preferences page to
676
                 allow adding a social network account.
676
                 allow adding a social network account.
677
        '''
677
        '''
678
        from allura.lib.widgets.forms import AddSocialNetworkForm
678
        from allura.lib.widgets.forms import AddSocialNetworkForm
679
        return AddSocialNetworkForm(action='/auth/prefs/add_social_network')
679
        return AddSocialNetworkForm(action='/auth/prefs/add_social_network')
680
680
681
    @LazyProperty 
681
    @LazyProperty
682
    def remove_socialnetwork_form(self):
682
    def remove_socialnetwork_form(self):
683
        '''
683
        '''
684
        :return: None, or an easywidgets Form to render on  the user preferences page to 
684
        :return: None, or an easywidgets Form to render on  the user preferences page to
685
                 allow removing a social network account.
685
                 allow removing a social network account.
686
        '''
686
        '''
687
        from allura.lib.widgets.forms import RemoveSocialNetworkForm
687
        from allura.lib.widgets.forms import RemoveSocialNetworkForm
688
        return RemoveSocialNetworkForm(action='/auth/prefs/remove_social_network')
688
        return RemoveSocialNetworkForm(action='/auth/prefs/remove_social_network')
689
689
690
    @LazyProperty 
690
    @LazyProperty
691
    def add_timeslot_form(self): 
691
    def add_timeslot_form(self):
692
        ''' 
692
        '''
693
        :return: None, or an easywidgets Form to render on the user preferences page
693
        :return: None, or an easywidgets Form to render on the user preferences page
694
                 to allow creating a new availability timeslot
694
                 to allow creating a new availability timeslot
695
        ''' 
695
        '''
696
        from allura.lib.widgets.forms import AddTimeSlotForm 
696
        from allura.lib.widgets.forms import AddTimeSlotForm
697
        return AddTimeSlotForm()
697
        return AddTimeSlotForm()
698
698
699
    @LazyProperty 
699
    @LazyProperty
700
    def remove_timeslot_form(self): 
700
    def remove_timeslot_form(self):
701
        ''' 
701
        '''
702
        :return: None, or an easywidgets Form to render on the user preferences page
702
        :return: None, or an easywidgets Form to render on the user preferences page
703
                 to remove a timeslot
703
                 to remove a timeslot
704
        ''' 
704
        '''
705
        from allura.lib.widgets.forms import RemoveTimeSlotForm 
705
        from allura.lib.widgets.forms import RemoveTimeSlotForm
706
        return RemoveTimeSlotForm()
706
        return RemoveTimeSlotForm()
707
707
708
    @LazyProperty 
708
    @LazyProperty
709
    def add_inactive_period_form(self): 
709
    def add_inactive_period_form(self):
710
        ''' 
710
        '''
711
        :return: None, or an easywidgets Form to render on the user preferences page
711
        :return: None, or an easywidgets Form to render on the user preferences page
712
                 to allow creating a new period of inactivity
712
                 to allow creating a new period of inactivity
713
        ''' 
713
        '''
714
        from allura.lib.widgets.forms import AddInactivePeriodForm
714
        from allura.lib.widgets.forms import AddInactivePeriodForm
715
        return AddInactivePeriodForm()
715
        return AddInactivePeriodForm()
716
716
717
    @LazyProperty 
717
    @LazyProperty
718
    def remove_inactive_period_form(self): 
718
    def remove_inactive_period_form(self):
719
        ''' 
719
        '''
720
        :return: None, or an easywidgets Form to render on the user preferences page
720
        :return: None, or an easywidgets Form to render on the user preferences page
721
                 to allow removing an existing period of inactivity
721
                 to allow removing an existing period of inactivity
722
        ''' 
722
        '''
723
        from allura.lib.widgets.forms import RemoveInactivePeriodForm
723
        from allura.lib.widgets.forms import RemoveInactivePeriodForm
724
        return RemoveInactivePeriodForm()
724
        return RemoveInactivePeriodForm()
725
725
726
    @LazyProperty
726
    @LazyProperty
727
    def add_trove_category(self):
727
    def add_trove_category(self):
...
...
733
        return AddTroveCategoryForm(action='/categories/create')
733
        return AddTroveCategoryForm(action='/categories/create')
734
734
735
    @LazyProperty
735
    @LazyProperty
736
    def remove_trove_category(self):
736
    def remove_trove_category(self):
737
        '''
737
        '''
738
        :return: None, or an easywidgets Form to render on the page to remove 
738
        :return: None, or an easywidgets Form to render on the page to remove
739
                 an existing trove_category
739
                 an existing trove_category
740
        '''
740
        '''
741
        from allura.lib.widgets.forms import RemoveTroveCategoryForm
741
        from allura.lib.widgets.forms import RemoveTroveCategoryForm
742
        return RemoveTroveCategoryForm(action='/categories/remove')
742
        return RemoveTroveCategoryForm(action='/categories/remove')
743
743