Changeset 20b3fcc6b52236b404b7d7aaf1517f57be3f84a2
- Timestamp:
- 11/06/09 22:20:07 (10 months ago)
- Author:
- Stephen Bennett <spb@…>
- Parents:
- 2090df0c85d347d43405ce36c1fd4a76ac8fab4d
- Children:
- a75ca74156bfac8b92c3b87b2c120d446dcf5345
- git-committer:
- Stephen Bennett <spb@exherbo.org> / 2009-11-06T22:20:07Z+0000
- Message:
-
Use the database validation of uniqueness in group names
- Location:
- lib/GMS
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r4b12c94
|
r20b3fcc
|
|
| 74 | 74 | } |
| 75 | 75 | |
| | 76 | sub insert { |
| | 77 | my $self=shift; |
| | 78 | try { |
| | 79 | return $self->next::method(@_); |
| | 80 | } |
| | 81 | catch (DBIx::Class::Exception $e) { |
| | 82 | if ("$e" =~ /unique_group_name/) { |
| | 83 | die GMS::Exception->new("A group with that name already exists."); |
| | 84 | } else { |
| | 85 | die $e; |
| | 86 | } |
| | 87 | } |
| | 88 | } |
| | 89 | |
| 76 | 90 | sub use_automatic_verification { |
| 77 | 91 | my ($name, $url) = @_; |
-
|
r78afb7b
|
r20b3fcc
|
|
| 54 | 54 | |
| 55 | 55 | my $group_rs = $c->model('DB::Group'); |
| 56 | | |
| 57 | | if ($group_rs->find({ groupname => $p->{group_name} })) |
| 58 | | { |
| 59 | | $c->flash->{errors} = [ "A group with that name already exists." ]; |
| 60 | | # Merge params into the flash so that they get back into the form for the second try. |
| 61 | | %{$c->flash} = ( %{$c->flash}, %$p ); |
| 62 | | $c->response->redirect($c->uri_for('/group/new')); |
| 63 | | return; |
| 64 | | } |
| 65 | 56 | |
| 66 | 57 | my $group; |